Checking Termination of Queries to Logic Programs

نویسندگان

  • N Lindenstrauss
  • Y Sagiv
چکیده

Termination of programs is known to be undecidable. However in the case of logic programs , where the only possible cause for non-termination is innnite recursion, termination can actually be proved automatically for a large class of programs. This paper describes an algorithm for automatically checking termination of queries to logic programs. Given a program and query the algorithm either answers that the query terminates or that there may be non-termination due to innnite recursion. The algorithm can use any norm of a wide family of norms for proving termination. It has been implemented in SICStus Prolog. The implementation can handle automatically most of the examples we encountered in the literature on termination of logic programs, and about half the programs in a collection of benchmarks, which were originally used for purposes other than termination (for 11 of the 24 programs termination can be decided automatically and for 3 more it can be decided after suitable transformation or division to parts). The algorithm consists of three main parts| instantiation analysis, constraint inference, and construction of the query-mapping pairs associated with the program and query. It uses weighted rule graphs, which extract the information about argument norms that is in the program rules. A by-product of the inference of constraints is the separation of recursive monotonicity constraints from nonrecursive ones. This enables us to spot programs for which we will be able to prove termination after unfolding.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

TermiLog: A System for Checking Termination of Queries to Logic Programs

TermiLog is a system implemented in SICStus Prolog for automatically checking termination of queries to logic programs. Given a program and query, the system either answers that the query terminates or that it cannot prove termination. The system can handle automatically 82% of the 120 programs we tested it on.

متن کامل

Termination Analysis of General Logic Programs for Moded Queries: A Dynamic Approach

The termination problem of a logic program can be addressed in either a static or a dynamic way. A static approach performs termination analysis at compile time, while a dynamic approach characterizes and tests termination of a logic program by applying a loop checking technique. In this paper, we present a novel dynamic approach to termination analysis for general logic programs with moded que...

متن کامل

Verifying Termination of General Logic Programs with Concrete Queries

We introduce a method of verifying termination of logic programs with respect to concrete queries (instead of abstract query patterns). A necessary and sufficient condition is established and an algorithm for automatic verification is developed. In contrast to existing query pattern-based approaches, our method has the following features: (1) It applies to all general logic programs with non-fl...

متن کامل

cTI: A constraint-based termination inference tool for ISO-Prolog

We present cTI, the first system for universal left-termination inference of logic programs. Termination inference generalizes termination analysis and checking. Traditionally, a termination analyzer tries to prove that a given class of queries terminates. This class must be provided to the system, for instance by means of user annotations. Moreover, the analysis must be redone every time the c...

متن کامل

Applying Static Analysis Techniques for Inferring Termination Conditions of Logic Programs

We present the implementation of cTI, a system for universal left-termination inference of logic programs, which heavily relies on static analysis techniques. Termination inference generalizes termination analysis/checking. Traditionally, a termination analyzer tries to prove that a given class of queries terminates. This class must be provided to the system, requiring user annotations. With te...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1996